#include<stdio.h>
#include<math.h>
int main()
{
	int i,n,d;
	int x;
	int sum=0;
	scanf("%d%d",&x,&n);
	for (i=1;i<=n;i++)
	{
		d=pow(x,i);
		sum+=d;
		printf("d=%d,sum=%d\n",d,sum);
	}
	printf("%d",sum);
   return 0;
}

